<template>
  <div class="list">
      <detailHead :title='title'></detailHead>
      <div v-if="arr.length > 0">
        <div class="list_item" v-for="(item,index) in arr " :key="index">
            <div class="title">
                <span class="blue"></span>
                <h4>{{item.address}}</h4>
            </div>
                <div class="content" @click="heandClick(item)">
                    <div class="item" >
                        <span class="item_t">所处楼层</span>
                        <span class="item_c">{{item.floor}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">建设时间</span>
                        <span class="item_c">{{item.construction_time}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">保洁状况</span>
                        <span class="item_c">{{item.cleaning_status}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">厕位数量</span>
                        <span class="item_c">{{item.man_num + item.female_num}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">是否专人管理</span>
                        <span class="item_c">{{item.manage}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">是否有管理间</span>
                        <span class="item_c">{{item.workshop}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">是否有指示牌</span>
                        <span class="item_c">{{item.indicator}}</span>
                    </div>
                </div>
        </div>
      </div>
      <div v-else class="none">
         <img src="@/assets/not-found.png" alt="">
         <span>抱歉，暂无搜索结果</span>
      </div>
            <div class="foot1">本服务由咸宁市城市管理执法委员会提供</div>
  </div>
</template>

    <script src="https://prod-pass4.ehbapp.hubei.gov.cn:30443/static/jssdk/jssdk.js"></script>
    <script src="http://zwfw.hubei.gov.cn/s/hbzwfw_jssdk/js/jssdk.js"></script>
<script>
import detailHead from "@/components/detailHead.vue";
import axios from 'axios'
import { Toast } from 'vant';
export default {
    components: {
        detailHead,
    },
    data(){
        return{
            arr:[],
            title:'公厕查询'
        }
    },
    mounted(){
        // console.log(111,this.$route.query)
        this.getList(this.$route.query.searchKey)
    },
    methods:{
        async getList(val){
            // {data:{data}}
            const {data:{data}} = await axios.get(
                'https://ehb-app.xngxq.cn/background/lavatory/query',
                {
                    params:{
                        area:val
                    }
                }
            )
            this.arr = data.list
            if(data.total <= 0 ){
                Toast('暂无搜索结果');
            }
            console.log(333,data)
       
        },
        heandClick (item) {
            console.log(444,item)
            this.$router.push({path:'/map',query:item})
            // console.log(ehbAppJssdk.map);
            // ehbAppJssdk.map.openMapNavigation({
            //     // destination: item.address,
            //     // longitude: item.longitude,
            //     // latitude: item.latitude,
            //         destination: "光谷广场",
            //         longitude: '114.4044980000',
            //         latitude: '30.5117950000'
            // })
        }
    }
}
</script>

<style lang='less' scoped>
.list{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    .list_item{
        width: 90%;
        border-bottom: 1px solid #eee;
        margin-bottom: 10px;
        .title{
            display: flex;
            align-items: center;
            .blue{
                width: 5px;
                height: 20px;
                background-color: rgb(94, 188, 243);
                margin-right: 4px;
            }
            h4{
                color: rgb(83, 84, 85);
            }
        }
        .content{
            margin-left: 10px;
            margin-top: -5px;
            margin-bottom: 10px;
            color: rgb(129, 127, 127);
            padding-top: 10px;
            .item{
                display: flex;
                .item_t{
                    font-size: 15px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #999999;
                    width: 110px;
                    margin-right: 8px;
                }
                .item_c{
                    font-size: 15px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #999999;
                    width: 200px;
                }
            }
        }
    }
        .foot1{
            color: #999999;
            font-size: 14px;
            text-align: center;
            position: fixed;
            bottom: 20px;
        }
}
.none{
    width: 70%;
    height: 70%;
    margin-top: 50%;
    color: #999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    span{
        color: #999;
        margin-top: 15px;
        font-size: 14px;
    }
}
</style>